<script type="text/javascript" >
    jQuery(document).ready(function(){
        jQuery('.stExtra').remove();
    });
    function set_size(){
        var size = jQuery("#result").height();
        size = size+50;
        jQuery(".pp_content").attr('style','height:'+size+'px');
    }
    stFacebookToolbox.load_tooltip();
    stFacebookToolboxcustom.on_submitform_new('#template_upload');
    stFacebookToolbox.loadUploadButton('200');
    stFacebookToolbox.loadRemoveButton();
    stFacebookToolbox.shortAction();
    stFacebookToolbox.sortColumn();
        jQuery("a[rel^='prettyPhoto']").prettyPhoto({
            theme:'facebook',
            default_height:100,
            keyboard_shortcuts: false
        });

</script>
<style>

</style>
<script>
function make_pdf(){
    window.open('<?php echo get_bloginfo('url');?>/coupon/user_export.php?campaign='+jQuery("#campaign").val()+'&format=pdf&sort=Name&popup=true&user=<?php echo $user;?>');
}
</script>
<div class="w100p bgl" id="stcontainer">
    <div class="w100p bgr p5b" id="result" >
       
  
<table class="widefat" cellspacing="0">
                <thead>
                    <tr>
                        <?php print_column_headers('stFacebookToolbox_stFacebookToolbox'); ?>
                    </tr>
                </thead>

                <tbody>
                <?php
                if (count($results) > 0) {
                    
                    $tr_class = "";
                    $upload_data = wp_upload_dir();
                    foreach ($results as $result) {
                        $array = explode('-',$result->BirthDate);
                        $birthday = $array[2].'.'.$array[1].'.'.$array[0];
                        $gender = ($result->Gender == 1)?'Male':'Female';
                       // $description  = (strlen($result->CouponTemplateDescription) > 35)?substr($result->CouponTemplateDescription,0,35).'...':$result->CouponTemplateDescription;
                        if( empty($tr_class) || $tr_class == "class='bg_gray2'"){
                            $tr_class = "class='bg_gray1'";
                        }else{
                            $tr_class = "class='bg_gray2'";
                        }
                        echo "<tr id='$result->CouponUserID' $tr_class >"
                        . "<td>" . $result->Name
                        . "<div class=\"row-actions short_action\">"
                        . "<span short_action='' id= '' action='' class='' onclick='jQuery.prettyPhoto.loadPage(\"coupon&user_id=$result->CouponUserID\",null,null,function(){set_size();})'>Show coupons</span> | "
                        . "<span  short_action='' id='' action='' class='edit'  onclick='window.open(\"http://www.facebook.com/profile.php?id=$result->FacebookUserID\");'>Facebook profile</span> | "
                        . "<span class='trash' short_action='delete' id='$result->CouponUserID' confirm='Are you sure you want to delete this user ?' style='cursor:pointer;'>Trash </span>"
                        . "</div>"
                        . "</td>"
                        . "<td>"
                        . $gender
                        . "</td>"
                        . "<td>{$result->email}"
                        . "</td>"
                        . "<td>$birthday"
                        . "</td>"
                        . "<td>{$result->HomeTown}"
                        . "</td>"
                        . "<td";
                        if($model->get_referrer($result->CouponUserID) > 0)
                                echo ' style="cursor:pointer;" onclick=\'jQuery.prettyPhoto.loadPage("coupon_user_referer&referer='.$result->CouponUserID.'",null,null,function(){set_size();})\' ';
                        echo "> {$model->get_referrer($result->CouponUserID)}/".($all_user - $model->get_referrer($result->CouponUserID))
                        . "</td>"
                        
                        . "</tr>"
                        ;
                    }
                }
                ?>
                </tbody>
            </table>
            <div class="page_d">
                <?php echo $pagination?>
                <div class="cl"></div>
            </div>
    </div>
</div>